package com.hdd.hll.quartz.quartzstarter;

import lombok.extern.slf4j.Slf4j;
import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 项目启动时开启schedule
 * @author jw
 */
@Slf4j
@Component
public class QuartzStarter implements ApplicationRunner {
    @Autowired
    private Scheduler scheduler;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        scheduler.start();
    }
}
